import request from '@/plugins/axios'

// 栏目列表
export const getBoardList = (): Promise<{ list: Board[] }> => request({
  url: 'admin/board_list'
})

// 新建栏目信息
export const submitBoard = (data: Board): Promise<Board> => request({
  url: data.id ? `admin/board/${data.id}` : 'admin/board',
  method: data.id ? 'put' : 'post',
  data
})

// 修改栏目信息
export const editBoard = (data: Board) => request({
  url: 'admin/board',
  method: 'put',
  data
})

// 删除栏目信息
export const deleteBoard = (id: number) => request({
  url: `admin/board/${id}`,
  method: 'delete'
})

// 栏目类别类型
export const getBoardTypes = (): Promise<{ list: BoardType[] }> => request({
  url: 'admin/board_types'
})
